package plus.chendd.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import plus.chendd.entity.TrainingMenu;
import plus.chendd.service.TrainingMenuService;

import java.util.List;

@RestController
@RequestMapping("/trainingMenu")
public class TrainingMenuController {
  
  @Autowired
  private TrainingMenuService menuService;
  
  @GetMapping("/findAll")
  public List<TrainingMenu> findAll() {
    return menuService.findAll();
  }
  
  @GetMapping("/findById/{id}")
  public TrainingMenu findById(@PathVariable("id") String id) {
    return menuService.findById(id);
  }
  
  @PostMapping("/update")
  public String update(@RequestBody TrainingMenu trainingMenu) {
    menuService.updateById(trainingMenu);
    return "success";
  }
}
